package com.z.admin.controller;

import com.z.admin.service.IBlogTagsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("api")
public class ApiController {

    @Autowired
    private IBlogTagsService blogTagsService;
    @GetMapping("index")
    public String index(Model model) {

        return "redirect:/admin/welcome";
    }
    @GetMapping("welcome")
    @ResponseBody
    public String welcome(Model model) {
        return "admin/welcome";
    }

    @GetMapping("test")
    @ResponseBody
    public String test(Model model) {
        try{
            blogTagsService.test();
        }catch (Exception e ){
            return e.getMessage();
        }
        return "success";
    }
}
